﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Administracija.DataLayer;

namespace Administracija
{
    public partial class RecnikBrowse : Form
    {
        AdministracijaDataContext dc;

        void RefreshGrid()
        {
            dc = new AdministracijaDataContext();
            bsRecnik.DataSource = dc.Recniks.Where(c=>c.JezikId == Convert.ToInt16(lkpJezik.EditValue.ToString()));
        }

        public RecnikBrowse()
        {
            InitializeComponent();
        }

        private void RecnikBrowse_Load(object sender, EventArgs e)
        {
            Common.MultiLanguage.Tool.PrevediFormu(this);

            dc = new AdministracijaDataContext();
            bsJezik.DataSource = dc.Jeziks;
            lkpJezik.EditValue = 1;
        }

        private void lkpJezik_EditValueChanged(object sender, EventArgs e)
        {
            RefreshGrid();
        }

        private void btnIzlaz_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void bsRecnik_PositionChanged(object sender, EventArgs e)
        {
            dc.SubmitChanges();
        }
    }
}
